<template>
    <div class="wrapper">
        <v-head></v-head>
        <v-sidebar></v-sidebar>
        <div class="content">
            <transition name="move" mode="out-in">
                <router-view></router-view>
            </transition>
        </div>
    </div>
</template>

<script>
import vHead from '../components/common/Header.vue';
import vSidebar from '../components/common/Sidebar.vue';
import { mapActions } from 'vuex'
import { getAllRoles, allOrg } from '../server/getDate.js'
import { setStore } from '../utils/local.js'
export default {
    components: {
        vHead, vSidebar
    },
    created() {
        this.getRoles()
        this.getOrganization()
    },
    methods: {
        ...mapActions(["saveRoles", 'saveOrg']),
        getRoles() {
            getAllRoles()
                .then(res => {
                    if (res.status === 0) {
                        setStore("roles", res.result)
                        this.saveRoles(res)
                    }
                })
        },
        getOrganization() {
            allOrg()
                .then(res => {
                    if (res.status === 0) {
                        this.saveOrg(res)
                    }
                })
        }
    }
}
</script>
